package com.example.demo.service;

import com.example.demo.mode.Student;
import com.example.demo.repository.StudentRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.stereotype.Component;

@Component
public class StudentService {
    @Autowired
    private StudentRepository studentRepository;
    public Object finAll(Student student)
    {
        return studentRepository.findAll(Example.of(student));
    }

    public void deleteById(String id){
        studentRepository.deleteById(id);
    }

    public void save(Student s){
        studentRepository.save(s);
    }

    public Student getReferenceById(String id){
        return studentRepository.getReferenceById(id);
    }
}
